gdk/surface: Make pending schedule a phase enum
authorJonas Ådahl <jadahl@gmail.com>
Tue, 24 Nov 2020 21:00:38 +0000 (22:00 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Mon, 7 Dec 2020 08:46:39 +0000 (09:46 +0100)
Scheduling an update when frozen would reschedule when unfrozen; change
this to a generic pending phase enum, and use this for resrcheduling
paint and compute-size.

gdk/gdksurface.c
gdk/gdksurfaceprivate.h

index 6cd7686bb2f0d7e4960a2c72c3862c47569520d1..f5f4a5790dc7f51e8eb7235bd42be3fa33f1da3f 100644 (file)
@@ -1290,7 +1290,7 @@ gdk_surface_schedule_update (GdkSurface *surface)
   if (surface->update_freeze_count ||
       gdk_surface_is_toplevel_frozen (surface))
     {
-      surface->pending_schedule_update = TRUE;
+      surface->pending_phases |= GDK_FRAME_CLOCK_PHASE_PAINT;
       return;
     }
 
@@ -1319,7 +1319,7 @@ gdk_surface_request_compute_size (GdkSurface *surface)
   if (surface->update_freeze_count ||
       gdk_surface_is_toplevel_frozen (surface))
     {
-      surface->pending_request_compute_size = TRUE;
+      surface->pending_phases |= GDK_FRAME_CLOCK_PHASE_COMPUTE_SIZE;
       return;
     }
 
@@ -1568,18 +1568,14 @@ gdk_surface_thaw_updates (GdkSurface *surface)
 
   if (--surface->update_freeze_count == 0)
     {
-      _gdk_frame_clock_inhibit_freeze (surface->frame_clock);
+      GdkFrameClock *frame_clock = surface->frame_clock;
 
-      if (surface->pending_schedule_update)
-        {
-          surface->pending_schedule_update = FALSE;
-          gdk_surface_schedule_update (surface);
-        }
+      _gdk_frame_clock_inhibit_freeze (frame_clock);
 
-      if (surface->pending_request_compute_size)
+      if (surface->pending_phases)
         {
-          surface->pending_request_compute_size = FALSE;
-          gdk_surface_request_compute_size (surface);
+          gdk_frame_clock_request_phase (frame_clock, surface->pending_phases);
+          surface->pending_phases = 0;
         }
     }
 }
index a6a981dbb86932cfc74e1fbf1af089842fa29709..196e2b9aebe92f61279b729417b781b9b19b90d7 100644 (file)
@@ -53,8 +53,7 @@ struct _GdkSurface
 
   cairo_region_t *update_area;
   guint update_freeze_count;
-  gboolean pending_schedule_update;
-  gboolean pending_request_compute_size;
+  GdkFrameClockPhase pending_phases;
   /* This is the update_area that was in effect when the current expose
      started. It may be smaller than the expose area if we'e painting
      more than we have to, but it represents the "true" damage. */